package cn.bugstack;


import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

//TIP 要<b>运行</b>代码，请按 <shortcut actionId="Run"/> 或
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
@SpringBootApplication
@MapperScan("cn.bugstack.dao")
@Configurable
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);

    }

//        // 启动时打印加载的Mapper XML文件
//    @Bean
//    public CommandLineRunner printMapperLocations() {
//        return args -> {
//            PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
//            // 这里的路径要和你application.yml中mybatis.mapper-locations配置一致
//            Resource[] resources = resolver.getResources("classpath:/mybatis/mappers/**/*.xml");
//            System.out.println("===== 加载的Mapper XML文件 =====");
//            for (Resource res : resources) {
//                System.out.println(res.getFile().getAbsolutePath());
//            }
//        };
//    }
}